package cn.iocoder.yudao.module.blog.dal.mysql.report;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.blog.dal.dataobject.report.BlogReportDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.blog.controller.admin.report.vo.*;

/**
 * 上报统计 Mapper
 *
 * @author 曹建伟
 */
@Mapper
public interface BlogReportMapper extends BaseMapperX<BlogReportDO> {

    default PageResult<BlogReportDO> selectPage(BlogReportPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BlogReportDO>()
                .eqIfPresent(BlogReportDO::getKeyword, reqVO.getKeyword())
                .betweenIfPresent(BlogReportDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BlogReportDO::getId));
    }

    default List<BlogReportDO> selectList(BlogReportExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BlogReportDO>()
                .eqIfPresent(BlogReportDO::getKeyword, reqVO.getKeyword())
                .betweenIfPresent(BlogReportDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BlogReportDO::getId));
    }

}
